/*
 * Powered By [rapid-framework]
 * Web Site: http://www.rapid-framework.org.cn
 * Google Code: http://code.google.com/p/rapid-framework/
 * Since 2008 - 2011
 */

package com.tech15.core.model;

import javax.persistence.*;

import org.hibernate.annotations.GenericGenerator;

import javax.validation.constraints.*;
import org.hibernate.validator.constraints.*;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import java.util.*;

import javacommon.base.*;
import javacommon.util.*;

import cn.org.rapid_framework.util.*;
import cn.org.rapid_framework.web.util.*;
import cn.org.rapid_framework.page.*;
import cn.org.rapid_framework.page.impl.*;

import com.tech15.core.model.*;
import com.tech15.core.dao.*;
import com.tech15.core.service.*;
import com.tech15.core.vo.query.*;

/**
 * @author 胡作正 email:zuozhenghu@sina.com
 * @version 1.0
 * @since 1.0
 */


@Entity
@Table(name = "SYS_MODULE_AUTH")
public class ModuleAuth extends BaseEntity implements java.io.Serializable{
	private static final long serialVersionUID = 5454155825314635342L;
	
	//alias
	public static final String TABLE_ALIAS = "ModuleAuth";
	public static final String ALIAS_MAID = "序号";
	public static final String ALIAS_MDID = "模块序号";
	public static final String ALIAS_AUTHID = "授权序号";
	public static final String ALIAS_AUTH_TYPE = "授权类型（1 用户 2 岗位 3 部门 4 组）";
	
	//date formats
	

	//可以直接使用: @Length(max=50,message="用户名长度不能大于50")显示错误消息
	//columns START
    /**
     * 序号       db_column: MAID 
     */ 	
	
	private Long maid;
    /**
     * 模块序号       db_column: MDID 
     */ 	
	
	private Long mdid;
    /**
     * 授权序号       db_column: AUTHID 
     */ 	
	
	private Long authid;
    /**
     * 授权类型（1 用户 2 岗位 3 部门 4 组）       db_column: AUTH_TYPE 
     */ 	
	@Length(max=1)
	private java.lang.String authType;
	//columns END


	public ModuleAuth(){
	}

	public ModuleAuth(
		Long maid
	){
		this.maid = maid;
	}

	

	public void setMaid(Long value) {
		this.maid = value;
	}
	
	@Id @GeneratedValue(generator="custom-id")
	@GenericGenerator(name="custom-id", strategy = "increment")
	@Column(name = "MAID", unique = true, nullable = false, insertable = true, updatable = true, length = 22)
	public Long getMaid() {
		return this.maid;
	}
	
	@Column(name = "MDID", unique = false, nullable = true, insertable = true, updatable = true, length = 22)
	public Long getMdid() {
		return this.mdid;
	}
	
	public void setMdid(Long value) {
		this.mdid = value;
	}
	
	@Column(name = "AUTHID", unique = false, nullable = true, insertable = true, updatable = true, length = 22)
	public Long getAuthid() {
		return this.authid;
	}
	
	public void setAuthid(Long value) {
		this.authid = value;
	}
	
	@Column(name = "AUTH_TYPE", unique = false, nullable = true, insertable = true, updatable = true, length = 1)
	public java.lang.String getAuthType() {
		return this.authType;
	}
	
	public void setAuthType(java.lang.String value) {
		this.authType = value;
	}
	

	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
			.append("Maid",getMaid())
			.append("Mdid",getMdid())
			.append("Authid",getAuthid())
			.append("AuthType",getAuthType())
			.toString();
	}
	
	public int hashCode() {
		return new HashCodeBuilder()
			.append(getMaid())
			.toHashCode();
	}
	
	public boolean equals(Object obj) {
		if(obj instanceof ModuleAuth == false) return false;
		if(this == obj) return true;
		ModuleAuth other = (ModuleAuth)obj;
		return new EqualsBuilder()
			.append(getMaid(),other.getMaid())
			.isEquals();
	}
	
	private String userIds;
	private String deptIds;
	private String groupIds;
	private String modName;
	private String orgType;
	private String name;
	private String userName;
	private String orgInfo;
	
	private List<ModuleAuth> authUsers = new ArrayList<ModuleAuth>();
	private List<ModuleAuth> authDepts = new ArrayList<ModuleAuth>();
	private List<ModuleAuth> authGroups = new ArrayList<ModuleAuth>();
	@Transient
	public List<ModuleAuth> getAuthDepts() {
		return authDepts;
	}

	public void setAuthDepts(List<ModuleAuth> authDepts) {
		this.authDepts = authDepts;
	}
	@Transient
	public List<ModuleAuth> getAuthGroups() {
		return authGroups;
	}

	public void setAuthGroups(List<ModuleAuth> authGroups) {
		this.authGroups = authGroups;
	}
	@Transient
	public List<ModuleAuth> getAuthUsers() {
		return authUsers;
	}

	public void setAuthUsers(List<ModuleAuth> authUsers) {
		this.authUsers = authUsers;
	}

	@Transient
	public String getModName() {
		return modName;
	}

	public void setModName(String modName) {
		this.modName = modName;
	}
	@Transient
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	@Transient
	public String getOrgType() {
		return orgType;
	}

	public void setOrgType(String orgType) {
		this.orgType = orgType;
	}
	@Transient
	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	@Transient
	public String getDeptIds() {
		return deptIds;
	}

	public void setDeptIds(String deptIds) {
		this.deptIds = deptIds;
	}
	@Transient
	public String getGroupIds() {
		return groupIds;
	}

	public void setGroupIds(String groupIds) {
		this.groupIds = groupIds;
	}
	@Transient
	public String getUserIds() {
		return userIds;
	}

	public void setUserIds(String userIds) {
		this.userIds = userIds;
	}
	@Transient
	public String getOrgInfo() {
		return orgInfo;
	}

	public void setOrgInfo(String orgInfo) {
		this.orgInfo = orgInfo;
	}
}

